<?php
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('data_setting', false);
my_component_load('unsur_evaluasi' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$uid = isset( $_GET['uid'] ) ? $_GET['uid']:  0;
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$penilaian_id = isset( $_GET['penilaian_id'] ) ? $_GET['penilaian_id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data _BN_ Unsur Evaluasi";

if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case   "penilaian_page" :
			$validatepost = form_penilaian_validate($id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_penilaian_create($id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_penilaian_submit($id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			my_direct('index.php?com=unsur_evaluasi');
			break;	
		case   "unsur_evaluasi_page" :
			$validatepost = form_unsur_evaluasi_validate($penilaian_id, $id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_unsur_evaluasi_create($penilaian_id, $id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_unsur_evaluasi_submit($penilaian_id, $id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			my_direct('index.php?com=unsur_evaluasi&task=list_penilaian&id='.$penilaian_id);
			break;
		case   "evaluasi_page" :
			$validatepost = form_evaluasi_validate($id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_evaluasi_create($uid,$id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_evaluasi_submit($uid,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			my_direct('index.php?com=unsur_evaluasi&task=list_evaluasi&uid='.$uid);
			break;	
	}
else: 
	if($task == "evaluasi_page"){ 
		$content  = form_evaluasi_create($uid,$id);
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "evaluasi_create"){ 
		$title= ($id > '0' ) ?  "Perubahan Data Evaluasi" : "Tambah Data Evaluasi";
		facebox_page('index.php?com=unsur_evaluasi&task=evaluasi_page&uid='.$uid.'&id='.$id  , $title , 260	);
	}elseif($task =='evaluasi_delete'){
		 delete_evaluasi($id);
		 my_direct($_SERVER['HTTP_REFERER']);	
	}elseif($task =='list_evaluasi'){		 
		$pagename = "Daftar Evaluasi";
		load_facebox_script();
		$view =  list_evaluasi($uid); 
		$href = 'index.php?com=unsur_evaluasi&task=evaluasi_create&uid='.$uid.'&id=0';		

	}elseif($task == "unsur_evaluasi_page"){ 
		$content  = form_unsur_evaluasi_create($penilaian_id, $id);
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "unsur_evaluasi_create"){ 
		$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=unsur_evaluasi&task=unsur_evaluasi_page&penilaian_id='.$penilaian_id.'&id='.$id , $title , 220	);
	}elseif($task =='unsur_evaluasi_delete'){
		 delete_unsur_evaluasi($id);
		 my_direct($_SERVER['HTTP_REFERER']);		 
	}elseif($task =='list_unsur_evaluasi'){
		$pagename = "Unsur Evaluasi";
		load_facebox_script();
		$view =  list_unsur_evaluasi($penilaian_id); 
		$href = 'index.php?com=unsur_evaluasi&task=unsur_evaluasi_create';

	}elseif($task == "penilaian_page"){ 
		$content  = form_penilaian_create($id);
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "penilaian_create"){ 
		$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=unsur_evaluasi&task=penilaian_page&id='.$id , $title , 220	);
	}elseif($task =='penilaian_delete'){
		 delete_penilaian($id);
		 my_direct($_SERVER['HTTP_REFERER']);		 
	}else{
		$pagename = "Penilaian Unsur Evaluasi";
		load_facebox_script();
		$view =  list_penilaian(); 
		$href = 'index.php?com=unsur_evaluasi&task=penilaian_create';
	}
endif; 
$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname );

?>